<template>
	<el-dialog v-model="modifyVisible" width="500">
		<template #header>
			<h2 class="title">修改卫生检查记录</h2>
		</template>
		<el-form :model="data" label-width="70px" label-position="left">
			<el-row>
				<el-col :span="10">
					<el-form-item label="卫生编号">
						<el-input v-model.number="data.hygId" readonly />
					</el-form-item>
					<el-form-item label="楼栋号">
						<el-input v-model.number="data.buildId" readonly />
					</el-form-item>
					<el-form-item label="房间号">
						<el-input v-model.number="data.dorNumber" />
					</el-form-item>
				</el-col>
				<el-col :span="10" :offset="2">
					<el-form-item label="检查人">
						<el-input v-model="data.checkPerson" />
					</el-form-item>
					<el-form-item label="分数">
						<el-input v-model="data.checkSore" />
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="22">
					<el-form-item label="检查内容">
						<el-input
							v-model.trim="data.hygDes"
							type="textarea"
							maxlength="200"
							resize="none"
							:autosize="{ minRows: 2, maxRows: 6 }" />
					</el-form-item>
				</el-col>
			</el-row>
		</el-form>
		<template #footer>
			<div class="dialog-footer">
				<el-button @click="modifyVisible = false">取消</el-button>
				<el-button type="primary" @click="handleModLog"> 修改记录 </el-button>
			</div>
		</template>
	</el-dialog>
</template>

<script setup>

import { updateHygByHou } from '@/utils/axios/domiRequests'
const modifyVisible = defineModel('modifyVisible', { required: true })

const props = defineProps(['data'])

function handleModLog() {
	props.data.houId = Number.parseInt(props.data.houId)
	props.data.dorNumber = Number.parseInt(props.data.dorNumber)
	props.data.buildId = Number.parseInt(props.data.buildId)
	updateHygByHou(props.data).then(() => (modifyVisible.value = false))
}
</script>

<style scoped lang="scss">
.title {
	font-size: 20px;
	margin-bottom: 10px;
	color: #79bbff;
}

.el-input {
	box-shadow: 0 0 3px #79bbff;
}
.el-textarea {
	box-shadow: 0 0 3px #79bbff;
}
</style>
